<template>
  <div class="app-container p-rel">
    <div class="container-title">查询</div>
    <el-form :model="queryParams"   ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="85px">
      <el-row :gutter="15">
        <el-col :lg="8" :xl="6">
          <el-form-item label="案件名称" prop="caseName">
            <el-input
              v-model="queryParams.caseName"
              placeholder="请输入案件名称"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="8" :xl="6">
          <el-form-item label="统一信用代码" prop="creditCode" label-width="120px">
            <el-input
              v-model="queryParams.creditCode"
              placeholder="请输入统一信用代码"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="8" :xl="6">
          <el-form-item label="行政相对人" prop="relativePerson">
            <el-input
              v-model="queryParams.relativePerson"
              placeholder="请输入行政相对人"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="8" :xl="6">
          <el-form-item label="镇/街道" prop="town">
            <el-input
              v-model="queryParams.town"
              placeholder="请输入镇/街道"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="8" :xl="6">
          <el-form-item label="详细地址" prop="addr">
            <el-input
              v-model="queryParams.addr"
              placeholder="请输入详细地址"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="8" :xl="6">
            <el-button type="primary" icon="" size="" @click="handleQuery">搜索</el-button>
            <el-button icon="" size="" @click="resetQuery">重置</el-button>
        </el-col>
      </el-row>
    </el-form>


    <el-table v-loading="loading" :data="unlicensedCaseList">
      <el-table-column type="index" width="55" align="center" label="序号"/>
      <el-table-column label="案件名称" align="center" prop="caseName" />
      <el-table-column label="行政相对人" align="center" prop="relativePerson" />
      <el-table-column label="统一信用代码" align="center" prop="creditCode" />
      <el-table-column label="类型" align="center" prop="type" />
      <el-table-column label="类别" align="center" prop="category" />
      <el-table-column label="镇/街道" align="center" prop="town" />
      <el-table-column label="详细地址" align="center" prop="addr" />
      <el-table-column label="立案日期" align="center" prop="filingDate" />
      <el-table-column label="违法事实" align="center" prop="illegalFact" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { listUnlicensedCase } from "@/api/zhangping/unlicensedCase";
export default {
  name: "UnlicensedCase",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 无证行医案件表格数据
      unlicensedCaseList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        caseName: null,
        relativePerson: null,
        creditCode: null,
        type: null,
        category: null,
        town: null,
        townCode: null,
        addr: null,
        filingDate: null,
        illegalType: null,
        illegalFact: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      detailForm:{},
      isEdit:false,
      editVisible:false,
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询无证行医案件列表 */
    getList() {
      this.loading = true;
      listUnlicensedCase(this.queryParams).then(response => {
        this.unlicensedCaseList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        caseName: null,
        relativePerson: null,
        creditCode: null,
        type: null,
        category: null,
        town: null,
        townCode: null,
        addr: null,
        filingDate: null,
        illegalType: null,
        illegalFact: null,
        createId: null,
        createBy: null,
        createTime: null,
        updateId: null,
        updateBy: null,
        updateTime: null,
        delFlag: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
